import request from './request'

export const LoginService = async (data) => {
  return await request.post({ url: '/login', data })
}

export const logOutService = async () => {
  return await request.get({ url: '/logout' })
}

export const fetchUserInfoService = async () => {
  try {
    const data = await request.get({ url: '/getInfo' })
    return data.data
  } catch (error) {}
}

export const fetchRouterListService = async () => {
  const data = await request.get({ url: '/getRouters' })
  return data.data
}

export const fetchI18nService = async (params) => {
  let i18n = { data: {} }
  try {
    i18n = await request.get({ url: '/lang', params })
  } catch (error) {}
  return i18n.data || {}
}
